Linux_CentOS 6误删除的boot分区该如何还原恢复, 在CentOS 6系统中,因为不
SSH Secure Shell 3.2.9 (Build 283)
[root@localhost /]# ls /boot//查看/boot分区内容为空
8.最后启动界面如下
e2fs_stage1_5 iso9660_stage1_5 stage1 vstafs_stage1_5
grub System.map-2.6.32-71.el6.i686
Copyright (c) 2000-2003 SSH Communications Security Corp -
Device Boot Start End Blocks Id System
proc on /proc type proc (rw)
This version does not include PKI and PKCS #11 functionality.
/dev/sda2 13 144 1048576 82 Linux swap / Solaris
[root@localhost /]# mount /dev/sr0 /mnt//挂载cdrom设备到/mnt目录下
This copy of SSH Secure Shell is a non-commercial version.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
Partition 1 does not end on cylinder boundary.
Running “embed /grub/e2fs_stage1_5 (hd0)”。。。 26 sectors are embedded.
[root@localhost /]# grub//启动grub
[root@localhost /]# ls /boot //查看/boot分区内容
/dev/sr0 on /mnt type iso9660 (ro)
grub》 quit//退出
Units = cylinders of 16065 * 512 = 8225280 bytes
Checking if “/grub/stage1” exists.。。 yes
[root@localhost /]# cp -rf /usr/share/grub/i386-pc/* /boot/grub/ //把/usr/share/grub/i386-pc的所有内容拷贝到/boot/grub中。
Checking if “/grub/e2fs_stage1_5” exists.。。 yes
Done.
在CentOS 6系统中,因为不小心或操作失误导致boot分区被删除,遇到这种情况是否能够恢复被删除的boot分区呢?其实是可以的,下面随小编一起来了解下吧。
[root@localhost boot]# cd 。。//返回上层目录
[root@localhost /]# ls /boot//查看/boot分区内容
kernel /vmlinuz-2.6.32-71.el6.i686 ro root=https://www.xp.cn/dev/sda3 rhgb quiet//kernel所在位置以只读模式挂载/dev/sda3根分区rhgb quiet为安静模式不显示内核信息。
initramfs-2.6.32-71.el6.i686.img vmlinuz-2.6.32-71.el6.i686
[root@localhost /]# mount//查看所有挂载分区
[root@localhost /]# fdisk -l //查看分区
/dev/sda1 * 1 13 102400 83 Linux//这个为/boot启动分区
Filesystem type is ext2fs, partition type 0x83
Running “install /grub/stage1 (hd0) (hd0)1+26 p (hd0,0)/grub/stage2 /grub/grub.conf”。。。 succeeded
lists possible command completions. Anywhere else TAB lists the possible
config-2.6.32-71.el6.i686 symvers-2.6.32-71.el6.i686.gz
1.首先利用centos6镜像进入linux rescue救援模式。
最后填写grub.conf文件内容
initrd /initramfs-2.6.32-71.el6.i686.img//加载initrd镜像。
Sector size (logical/physical): 512 bytes / 512 bytes
initramfs-2.6.32-71.el6.i686.img vmlinuz-2.6.32-71.el6.i686
4.查找find /grub/stage1然后找到/boot分区为(hd0,0),指定kernel,initrd, boot启动系统成功。
[root@localhost /]# mkdir /boot/grub//在/boot目录新建一个grub目录
config-2.6.32-71.el6.i686 System.map-2.6.32-71.el6.i686
[root@localhost ~]# cd /boot //进入/boot分区
[root@localhost boot]# ls //查看boot分区的内容
上面就是CentOS 6恢复被删除boot分区的方法介绍了,步骤有些长,如果觉得麻烦的话可以重装系统,同样能恢复boot分区。
5.系统启动成功,然后进入系统重新写/boot/grub/grub.conf文件。
[root@localhost /]# rpm -ivh /mnt/Packages/kernel-2.6.32-71.el6.i686.rpm --root=https://www.xp.cn/ --force //安装光盘的kernel软件包
6.[root@localhost /]# vi /boot/grub/grub.conf配置文件如下:
timeout=6//等待时间为6秒
1:kernel ########################################### [100%]
initramfs-2.6.32-71.el6.i686.img vmlinuz-2.6.32-71.el6.i686
[root@localhost /]# rm -rf /boot/*//删除/boot分区所有内容
fat_stage1_5 jfs_stage1_5 stage2 xfs_stage1_5
255 heads, 63 sectors/track, 2610 cylinders
completions of a device/filename.]
devpts on /dev/pts type devpts (rw)
mount: block device /dev/sr0 is write-protected, mounting read-only
/dev/sda3 144 2611 19819520 83 Linux //这个为/根分区
Disk identifier: 0x000b1db4
grub System.map-2.6.32-71.el6.i686
[root@localhost /]# touch /boot/grub/grub.conf//新建一个grub.conf配置文件
[root@localhost /]# ls /boot/grub/ //查看/boot/grub目录内容
ffs_stage1_5 minix_stage1_5 stage2_eltorito
setup (hd0)
7.最后进入linux rescue重建一个grub
Checking if “/grub/stage2” exists.。。 yes
tmpfs on /dev/shm type tmpfs (rw)
default=0 //默认菜单为第一个
/dev/sda3 on / type ext4 (rw)//根分区
Probing devices to guess BIOS drives. This may take a long time.
grub》 setup (hd0)//重新安装grub
config-2.6.32-71.el6.i686 symvers-2.6.32-71.el6.i686.gz
/dev/sda1 on /boot type ext4 (rw)//boot分区为sda1
symvers-2.6.32-71.el6.i686.gz
root (hd0,0)//设置/boot分区为/dev/sda1
I/O size (minimum/optimal): 512 bytes / 512 bytes
2.启动sshd服务,查看eth0获取的ip地址,然后用ssh secure shell 连接。
3.重新reboot启动系统进入grub界面测试
title mylinux //启动标题为mylinux
Partition 2 does not end on cylinder boundary.
grub》 root (hd0,0) //首先find /grub/stage1查看/boot分区为(hd0,0)
root (hd0,0) //boot所在分区为/dev/sda1
Checking if “/boot/grub/stage1” exists.。。 no
[ Minimal BASH-like line editing is supported. For the first word, TAB
grub.conf reiserfs_stage1_5 ufs2_stage1_5
sysfs on /sys type sysfs (rw)
succeeded
Disk /dev/sda: 21.5 GB, 21474836480 bytes
Preparing.。。 ########################################### [100%]
相关热词: Linux
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/xt/linux/6169.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
并进行了数次优化更改
时间:2021-01-23
-
在Linus发表文章的第二年
时间:2021-01-23
-
当一个文件被加载时
时间:2021-01-21
-
与--delete 呼应的是--exis
时间:2021-01-21
-
$top top-18:50:38up6days
时间:2021-01-21
-
CLI和程序包管理器使开发
时间:2021-01-20
-
但是有时候这个系统上跑
时间:2021-01-20
-
配置好prometheus数据源
时间:2021-01-20
热门文章
-
Anki:让记忆更轻松的开源神器
时间:2020-12-22
-
配置好prometheus数据源
时间:2021-01-20
-
如何在Linux启动时自动启动LXD容器
时间:2020-12-22
-
使用Vi/Vim编辑器:基础篇
时间:2020-12-22
-
linux系统比windows系统声音小怎么办?
时间:2021-01-08
-
使用parallel利用起你的所有CPU资源
时间:2020-12-22
-
Zsync:一个仅下载文件新的部分的传输工
时间:2020-12-22
-
Linux SecureCRT显示乱码解决方案
时间:2021-01-05
-
linux 防御SYN攻击步骤详解
时间:2020-12-23
-
在Linus发表文章的第二年
时间:2021-01-23
